<?php
namespace Admin\Model;
use Think\Model\RelationModel;
class AdminModel extends RelationModel{
	//验证规则
    protected $_validate = array(     
        array('admin_name','require','请填写用户名'),
        array('admin_pwd','require','请填写密码'),
        array("admin_name","/^[a-zA-Z][a-zA-Z0-9_]{4,8}$/","用户名是5-8位，且首字母不能是数字"),
    );
	//关联查询用户所属的用户组
    protected $_link = array(
        'auth_group' => array(
            'mapping_type' => self::MANY_TO_MANY,
            'class_name' => 'auth_group',
            'mapping_name' => 'classify',
            'foreign_key' => 'uid',
            'relation_foreign_key' => 'group_id',
            'relation_table' => 'f_auth_group_access'
        )
    );
}
